{% extends 'core/base.html' %}
{% load bootstrap %}

{% block content %}
<h1 class="text-xs-center">Member management for team <a href="{{ team.get_absolute_url }}">{{ team }}</a></h1>
<div>
    <h3>Add user to team</h3>
<form class="form-inline" id="team-add-user-form" action="{% url 'dtracker-team-add-member' team.slug %}" method="POST">{% csrf_token %}
    {{ form|bootstrap_inline }}
    <button class="btn btn-default">Add member</button>
</form>
</div>
<div>
<h3>Team members</h3>
<ul class="list-group">
{% for member in members_list %}
<li class="list-group-item">
    <div class="row">
    <div class="col-md-10">{{ member }}</div>
    <div class="col-md-2">
        <form class="unstyled-form" action="{% url 'dtracker-team-remove-member' team.slug %}" method="POST">{% csrf_token %}
        <input type="hidden" name="email" value="{{ member }}">
        <button class="btn btn-xs btn-danger remove-user-button">Remove</button>
        </form>
    </div>
    </div>
</li>
{% endfor %}
</ul>
{% if is_paginated %}
<div class="text-xs-center">
<ul class="pagination">
    {% for page in page_obj.paginator.page_range %}
    <li class="page-item{% if page_obj.number == page %} active{% endif %}"><a class="page-link" href="?page={{ page }}">{{ page }}</a></li>
    {% endfor %}
</ul>
</div>
</div>
{% endif %}
{% endblock %}
